Biodepth

Dados

Biomassa

BIOMASSA <- read.csv("biodepth/BiodepthSpeciesBiomass.csv", sep = ";", h=T)

Sweden e Sheffield não tem funções de solo medidas & só tem funcoes medidas pra o ano 3 + portugal só sobra 2 amostras quando tira as especies que nao tenho traits = vou filtrar esses

BIOMASSA <- BIOMASSA %>%
  filter(!(site %in% c("Sweden", "Sheffield", "Portugal"))) %>%
  filter(year == 3)

###Biomassa relativa

BIOMASSA <- BIOMASSA %>%
  group_by(year, site, block, plot) %>%
  mutate(percentage_biomass = 100 * biomass / sum(biomass, na.rm = TRUE))

datatable(BIOMASSA, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
ggplot(BIOMASSA, aes(x = biomass)) +
  geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
  labs(title = "Biomassa Biodepth", 
       x = "Biomassa", 
       y = "Frequência") +
  theme_minimal()

ggplot(BIOMASSA, aes(x = percentage_biomass)) +
  geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
  labs(title = "Biomassa relativa Biodepth", 
       x = "Biomassa relativa", 
       y = "Frequência") +
  theme_minimal()

Passando de biomassa para composição de espécies

COMPOSICAO <- BIOMASSA %>% 
  group_by(year,location,site,block,plot,sr,fr,fgc,mix.nest,mix,grass,forb,legume,funct,GRASS,FORB,LEG) %>% 
  pivot_wider(
    names_from = species,
    values_from = percentage_biomass,
    values_fill = list(percentage_biomass=0))

#Germany

COMPOSICAO_GERMANY <- COMPOSICAO %>% 
  filter(site == "Germany")

#matrix de abundancia germany
abundance_germany <- COMPOSICAO_GERMANY %>%
  ungroup() %>%
  mutate(unique_plot = paste(plot, block, year, site, sep = "_")) %>%
  group_by(unique_plot) %>%
  summarise(across(where(is.numeric), sum, na.rm = TRUE)) %>%
  column_to_rownames(var = "unique_plot") %>% 
  dplyr::select(-year,-location, -sr, -fr,-fgc, -mix.nest, -mix, -biomass)
## Warning: There was 1 warning in `summarise()`.
## ℹ In argument: `across(where(is.numeric), sum, na.rm = TRUE)`.
## ℹ In group 1: `unique_plot = "B1P001_A_3_Germany"`.
## Caused by warning:
## ! The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
## Supply arguments directly to `.fns` through an anonymous function instead.
## 
##   # Previously
##   across(a:b, mean, na.rm = TRUE)
## 
##   # Now
##   across(a:b, \(x) mean(x, na.rm = TRUE))
# Cria a coluna 'riqueza' contando o número de espécies em cada plot
abundance_germany$riqueza <- rowSums(abundance_germany > 0)
abundance_germany_filtrado <- abundance_germany[abundance_germany$riqueza > 3, ]
abundance_germany_filtrado$riqueza <- NULL

#Remover espécies que não aparecem em nenhum plot
abundance_germany_filtrado <- abundance_germany_filtrado[, colSums(abundance_germany_filtrado, na.rm = TRUE) > 0]


abundance_matrix_germany <- as.matrix(abundance_germany_filtrado)

#Funcional Germany

# Funcional Germany
SPECIES_germany <- data.frame(species = colnames(abundance_matrix_germany))

SPECIES_germany$species <- tolower(SPECIES_germany$species)

TRAITS$species <- tolower(TRAITS$species) 
TRAITS_germany <- SPECIES_germany %>%
  inner_join(TRAITS, by = "species")

missing_traits_species_germany <- SPECIES_germany %>%
  anti_join(TRAITS, by = "species")

# Diversidade funcional Germany
rownames(TRAITS_germany) <- TRAITS_germany$species
TRAITS_rn_germany <- TRAITS_germany[,-1]

TRAITS_rn_germany <- TRAITS_rn_germany[order(rownames(TRAITS_rn_germany)), ]

# Matriz de distância dos traits
euclid_dis_germany <- vegdist(TRAITS_rn_germany, "euclidean")
trait_dat_germany <- as.matrix(euclid_dis_germany)

colnames(abundance_matrix_germany) <- tolower(trimws(colnames(abundance_matrix_germany)))
abundance_matrix_germany <- abundance_matrix_germany[, order(colnames(abundance_matrix_germany))]
fd <- dbFD(trait_dat_germany, abundance_matrix_germany)
## FRic: Dimensionality reduction was required. The last 23 PCoA axes (out of 26 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9860835
Functional_germany <- data.frame(raoq = fd$RaoQ, FRic = fd$FRic,FEve = fd$FEve, FDis = fd$FDis, FD = fd$nbsp )

datatable(Functional_germany, options= list(deferRender = TRUE,   scroller = TRUE,  scrollX=T, scrollY = "350px", autoWidth=T), rownames=T)
hist(Functional_germany$FRic)

hist(Functional_germany$raoq)

#Greece

COMPOSICAO_GREECE <- COMPOSICAO %>% 
  filter(site == "Greece")

#matrix de abundancia greece
abundance_greece <- COMPOSICAO_GREECE %>%
  ungroup() %>%
  mutate(unique_plot = paste(plot, block, year, site, sep = "_")) %>%
  group_by(unique_plot) %>%
  summarise(across(where(is.numeric), sum, na.rm = TRUE)) %>%
  column_to_rownames(var = "unique_plot") %>% 
  dplyr::select(-year,-location, -sr, -fr,-fgc, -mix.nest, -mix, -biomass)

# Cria a coluna 'riqueza' contando o número de espécies em cada plot
abundance_greece$riqueza <- rowSums(abundance_greece > 0)
abundance_greece_filtrado <- abundance_greece[abundance_greece$riqueza > 3, ]
abundance_greece_filtrado$riqueza <- NULL

#Remover espécies que não aparecem em nenhum plot
abundance_greece_filtrado <- abundance_greece_filtrado[, colSums(abundance_greece_filtrado, na.rm = TRUE) > 0]

abundance_matrix_greece <- as.matrix(abundance_greece_filtrado)

#Funcional Greece

SPECIES_greece <- data.frame(species = colnames(abundance_matrix_greece))

SPECIES_greece$species <- tolower(SPECIES_greece$species)

TRAITS$species <- tolower(TRAITS$species) 
TRAITS_greece <- SPECIES_greece %>%
  inner_join(TRAITS, by = "species")

missing_traits_species_greece <- SPECIES_greece %>%
  anti_join(TRAITS, by = "species")

# Diversidade funcional Greece
rownames(TRAITS_greece) <- TRAITS_greece$species
TRAITS_rn_greece <- TRAITS_greece[,-1]

TRAITS_rn_greece$SLA <- log(TRAITS_rn_greece$SLA)
TRAITS_rn_greece$height <- log(TRAITS_rn_greece$height)

TRAITS_rn_greece <- TRAITS_rn_greece[order(rownames(TRAITS_rn_greece)), ]
euclid_dis_greece <- vegdist(TRAITS_rn_greece, "euclidean")
trait_dat_greece <- as.matrix(euclid_dis_greece)
colnames(abundance_matrix_greece) <- tolower(trimws(colnames(abundance_matrix_greece)))
abundance_matrix_greece <- abundance_matrix_greece[, order(colnames(abundance_matrix_greece))]

fd_greece <- dbFD(trait_dat_greece, abundance_matrix_greece)
## FRic: Dimensionality reduction was required. The last 7 PCoA axes (out of 10 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9516844
Functional_greece <- data.frame(raoq = fd_greece$RaoQ, FRic = fd_greece$FRic, FEve = fd_greece$FEve, FDis = fd_greece$FDis, FD = fd_greece$nbsp)

datatable(Functional_greece, options= list(deferRender = TRUE, scroller = TRUE, scrollX = T, scrollY = "350px", autoWidth = T), rownames = T)
hist(Functional_greece$FRic)

hist(Functional_greece$raoq)

#Ireland

COMPOSICAO_IRELAND <- COMPOSICAO %>% 
  filter(site == "Ireland")

#matrix de abundancia ireland
abundance_ireland <- COMPOSICAO_IRELAND %>%
  ungroup() %>%
  mutate(unique_plot = paste(plot, block, year, site, sep = "_")) %>%
  group_by(unique_plot) %>%
  summarise(across(where(is.numeric), sum, na.rm = TRUE)) %>%
  column_to_rownames(var = "unique_plot") %>% 
  dplyr::select(-year,-location, -sr, -fr,-fgc, -mix.nest, -mix, -biomass)

# Cria a coluna 'riqueza' contando o número de espécies em cada plot
abundance_ireland$riqueza <- rowSums(abundance_ireland > 0)
abundance_ireland_filtrado <- abundance_ireland[abundance_ireland$riqueza > 3, ]
abundance_ireland_filtrado$riqueza <- NULL

#Remover espécies que não aparecem em nenhum plot
abundance_ireland_filtrado <- abundance_ireland_filtrado[, colSums(abundance_ireland_filtrado, na.rm = TRUE) > 0]

abundance_matrix_ireland <- as.matrix(abundance_ireland_filtrado)

#Funcional Ireland

SPECIES_ireland <- data.frame(species = colnames(abundance_matrix_ireland))

SPECIES_ireland$species <- tolower(SPECIES_ireland$species)

TRAITS$species <- tolower(TRAITS$species) 
TRAITS_ireland <- SPECIES_ireland %>%
  inner_join(TRAITS, by = "species")

missing_traits_species_ireland <- SPECIES_ireland %>%
  anti_join(TRAITS, by = "species")

# Diversidade funcional Ireland
rownames(TRAITS_ireland) <- TRAITS_ireland$species
TRAITS_rn_ireland <- TRAITS_ireland[,-1]

TRAITS_rn_ireland$SLA <- log(TRAITS_rn_ireland$SLA)
TRAITS_rn_ireland$height <- log(TRAITS_rn_ireland$height)

TRAITS_rn_ireland <- TRAITS_rn_ireland[order(rownames(TRAITS_rn_ireland)), ]
euclid_dis_ireland <- vegdist(TRAITS_rn_ireland, "euclidean")
trait_dat_ireland <- as.matrix(euclid_dis_ireland)
colnames(abundance_matrix_ireland) <- tolower(trimws(colnames(abundance_matrix_ireland)))
abundance_matrix_ireland <- abundance_matrix_ireland[, order(colnames(abundance_matrix_ireland))]

fd_ireland <- dbFD(trait_dat_ireland, abundance_matrix_ireland)
## FRic: Dimensionality reduction was required. The last 7 PCoA axes (out of 10 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9628097
Functional_ireland <- data.frame(raoq = fd_ireland$RaoQ, FRic = fd_ireland$FRic, FEve = fd_ireland$FEve, FDis = fd_ireland$FDis, FD = fd_ireland$nbsp)

datatable(Functional_ireland, options= list(deferRender = TRUE, scroller = TRUE, scrollX = T, scrollY = "350px", autoWidth = T), rownames = T)
hist(Functional_ireland$FRic)

hist(Functional_ireland$raoq)

#Silwood

COMPOSICAO_SILWOOD <- COMPOSICAO %>% 
  filter(site == "Silwood")

#matrix de abundancia silwood
abundance_silwood <- COMPOSICAO_SILWOOD %>%
  ungroup() %>%
  mutate(unique_plot = paste(plot, block, year, site, sep = "_")) %>%
  group_by(unique_plot) %>%
  summarise(across(where(is.numeric), sum, na.rm = TRUE)) %>%
  column_to_rownames(var = "unique_plot") %>% 
  dplyr::select(-year,-location, -sr, -fr,-fgc, -mix.nest, -mix, -biomass)

# Cria a coluna 'riqueza' contando o número de espécies em cada plot
abundance_silwood$riqueza <- rowSums(abundance_silwood > 0)
abundance_silwood_filtrado <- abundance_silwood[abundance_silwood$riqueza > 3, ]
abundance_silwood_filtrado$riqueza <- NULL

#Remover espécies que não aparecem em nenhum plot
abundance_silwood_filtrado <- abundance_silwood_filtrado[, colSums(abundance_silwood_filtrado, na.rm = TRUE) > 0]

abundance_matrix_silwood <- as.matrix(abundance_silwood_filtrado)

#Funcional Silwood

SPECIES_silwood <- data.frame(species = colnames(abundance_matrix_silwood))

SPECIES_silwood$species <- tolower(SPECIES_silwood$species)

TRAITS$species <- tolower(TRAITS$species) 
TRAITS_silwood <- SPECIES_silwood %>%
  inner_join(TRAITS, by = "species")

missing_traits_species_silwood <- SPECIES_silwood %>%
  anti_join(TRAITS, by = "species")

# Diversidade funcional Silwood
rownames(TRAITS_silwood) <- TRAITS_silwood$species
TRAITS_rn_silwood <- TRAITS_silwood[,-1]

TRAITS_rn_silwood$SLA <- log(TRAITS_rn_silwood$SLA)
TRAITS_rn_silwood$height <- log(TRAITS_rn_silwood$height)

TRAITS_rn_silwood <- TRAITS_rn_silwood[order(rownames(TRAITS_rn_silwood)), ]
euclid_dis_silwood <- vegdist(TRAITS_rn_silwood, "euclidean")
trait_dat_silwood <- as.matrix(euclid_dis_silwood)
colnames(abundance_matrix_silwood) <- tolower(trimws(colnames(abundance_matrix_silwood)))
abundance_matrix_silwood <- abundance_matrix_silwood[, order(colnames(abundance_matrix_silwood))]

fd_silwood <- dbFD(trait_dat_silwood, abundance_matrix_silwood)
## FRic: Dimensionality reduction was required. The last 19 PCoA axes (out of 22 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9660289
Functional_silwood <- data.frame(raoq = fd_silwood$RaoQ, FRic = fd_silwood$FRic, FEve = fd_silwood$FEve, FDis = fd_silwood$FDis, FD = fd_silwood$nbsp)

datatable(Functional_silwood, options= list(deferRender = TRUE, scroller = TRUE, scrollX = T, scrollY = "350px", autoWidth = T), rownames = T)
hist(Functional_silwood$FRic)

hist(Functional_silwood$raoq)

#Switzerland

COMPOSICAO_SWITZERLAND <- COMPOSICAO %>% 
  filter(site == "Switzerland")

#matrix de abundancia switzerland
abundance_switzerland <- COMPOSICAO_SWITZERLAND %>%
  ungroup() %>%
  mutate(unique_plot = paste(plot, block, year, site, sep = "_")) %>%
  group_by(unique_plot) %>%
  summarise(across(where(is.numeric), sum, na.rm = TRUE)) %>%
  column_to_rownames(var = "unique_plot") %>% 
  dplyr::select(-year,-location, -sr, -fr,-fgc, -mix.nest, -mix, -biomass)

# Cria a coluna 'riqueza' contando o número de espécies em cada plot
abundance_switzerland$riqueza <- rowSums(abundance_switzerland > 0)
abundance_switzerland_filtrado <- abundance_switzerland[abundance_switzerland$riqueza > 3, ]
abundance_switzerland_filtrado$riqueza <- NULL

#Remover espécies que não aparecem em nenhum plot
abundance_switzerland_filtrado <- abundance_switzerland_filtrado[, colSums(abundance_switzerland_filtrado, na.rm = TRUE) > 0]

abundance_matrix_switzerland <- as.matrix(abundance_switzerland_filtrado)

#Funcional Switzerland

SPECIES_switzerland <- data.frame(species = colnames(abundance_matrix_switzerland))

SPECIES_switzerland$species <- tolower(SPECIES_switzerland$species)

TRAITS$species <- tolower(TRAITS$species) 
TRAITS_switzerland <- SPECIES_switzerland %>%
  inner_join(TRAITS, by = "species")

missing_traits_species_switzerland <- SPECIES_switzerland %>%
  anti_join(TRAITS, by = "species")

# Diversidade funcional Switzerland
rownames(TRAITS_switzerland) <- TRAITS_switzerland$species
TRAITS_rn_switzerland <- TRAITS_switzerland[,-1]

TRAITS_rn_switzerland$SLA <- log(TRAITS_rn_switzerland$SLA)
TRAITS_rn_switzerland$height <- log(TRAITS_rn_switzerland$height)

TRAITS_rn_switzerland <- TRAITS_rn_switzerland[order(rownames(TRAITS_rn_switzerland)), ]
euclid_dis_switzerland <- vegdist(TRAITS_rn_switzerland, "euclidean")
trait_dat_switzerland <- as.matrix(euclid_dis_switzerland)
colnames(abundance_matrix_switzerland) <- tolower(trimws(colnames(abundance_matrix_switzerland)))
abundance_matrix_switzerland <- abundance_matrix_switzerland[, order(colnames(abundance_matrix_switzerland))]

fd_switzerland <- dbFD(trait_dat_switzerland, abundance_matrix_switzerland)
## FRic: Dimensionality reduction was required. The last 29 PCoA axes (out of 32 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9723384
Functional_switzerland <- data.frame(raoq = fd_switzerland$RaoQ, FRic = fd_switzerland$FRic, FEve = fd_switzerland$FEve, FDis = fd_switzerland$FDis, FD = fd_switzerland$nbsp)

datatable(Functional_switzerland, options= list(deferRender = TRUE, scroller = TRUE, scrollX = T, scrollY = "350px", autoWidth = T), rownames = T)
hist(Functional_switzerland$FRic)

hist(Functional_switzerland$raoq)

FUNCIONAL juntar

Abundance_juntar

abundance_filtrado <- bind_rows(
  abundance_germany_filtrado,
  abundance_greece_filtrado,
  abundance_ireland_filtrado,
  abundance_silwood_filtrado,
  abundance_switzerland_filtrado
)

MULTIFUNCIONALIDADE

multi <- cbind(dataset_biodep1, getStdAndMeanFunctions(dataset_biodep1, vars))

Dataset final

dataset_final <- multi %>%
  left_join(Functional, by = c("plot", "site"))

datatable(dataset_final, options= list(deferRender = TRUE,    scroller = TRUE, scrollY = "350px", scrollX=T, autoWidth=T), rownames=T)

Análise

cor_matrix
##           raoq        FRic        FEve      FDis         FD
## raoq 1.0000000  0.42836241  0.20097360 0.9556472  0.2919102
## FRic 0.4283624  1.00000000 -0.06933825 0.3621837  0.7967759
## FEve 0.2009736 -0.06933825  1.00000000 0.2808698 -0.2216051
## FDis 0.9556472  0.36218372  0.28086977 1.0000000  0.2787411
## FD   0.2919102  0.79677593 -0.22160514 0.2787411  1.0000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|site),data = biodepth[-46,])
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | site)
## Data: biodepth[-46, ]
## 
##      AIC      BIC   logLik deviance df.resid 
##   -209.7   -196.0    109.8   -219.7      108 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance Std.Dev.
##  site     (Intercept) 0.004622 0.06798 
##  Residual             0.007447 0.08629 
## Number of obs: 113, groups:  site, 5
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00745 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.3876263  0.0335883  11.541  < 2e-16 ***
## raoq        -0.0032736  0.0012854  -2.547 0.010870 *  
## FRic         0.0007642  0.0002017   3.789 0.000151 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## integer(0)
ggplot(biodepth, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(biodepth, aes(x = raoq, y = meanFunction, color = as.factor(site))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(site)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(biodepth, aes(x = FRic, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(biodepth, aes(x = FRic, y = meanFunction, color = as.factor(site))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(site)), method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

Ceedar Creek

e097

Avaliar o efeito de diferentes níveis de fertilização com nitrogênio em um experimento de competição de árvores.

9 TRTAMENTOS de adição de nitrogênio:
1: 0g/m²/ano nitrogênio (com micronutrientes)
2: 3g/m²/ano nitrogênio (com micronutrientes)
3: 6g/m²/ano nitrogênio (com micronutrientes)
4: 10g/m²/ano nitrogênio (com micronutrientes)
5: 16g/m²/ano nitrogênio (com micronutrientes)
6: 28g/m²/ano nitrogênio (com micronutrientes)
7: 50g/m²/ano nitrogênio (com micronutrientes)
8: 80g/m²/ano nitrogênio (com micronutrientes)
9: 0g/m²/ano (sem nitrogênio sem micronitrientes)

Dados

Biomassa

biomassa <- read.table("e097/e097_Plant aboveground biomass data.txt", h=T, sep="\t")

Filtrando o ano 1982 porque as funções foram coletadas aqui.

biomassa <- biomassa %>%  
  filter(year=="1982")

Biomassa relativa

biomassa <- biomassa %>%
  group_by(Field, plot.number) %>%
  mutate(percentage_biomass = 100 * Species.Biomass..g.m2. / sum(Species.Biomass..g.m2., na.rm = TRUE))

datatable(biomassa, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
ggplot(biomassa, aes(x = percentage_biomass)) +
  geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
  labs(title = "Biomassa relativa CEDAR CREEK e97", 
       x = "Biomassa relativa", 
       y = "Frequência") +
  theme_minimal()

###FUNCIONAL

# Cálculo da diversidade funcional
fd <- dbFD(trait_dat, abundance_matrix_clean)
## FRic: Dimensionality reduction was required. The last 60 PCoA axes (out of 64 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9789017
Functional <- data.frame(raoq = fd$RaoQ, FRic = fd$FRic,FEve = fd$FEve, FDis = fd$FDis, FD = fd$nbsp )

datatable(Functional, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

MULTIFUNCIONALIDADE

#Dataset junto das funções
funcoes <- potassioFunc %>%
  full_join(fosforoFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(calcioFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(magnesioFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(nitroFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(phFunc, by = c("Plot.number", "Field.letter"))
e97_multifuncionalidade <- cbind(datset_97, getStdAndMeanFunctions(datset_97, vars))

Dataset final

dataset_final_e97 <- e97_multifuncionalidade %>%
  left_join(Functional, by = c("Plot.number", "treatment", "Field.letter"))

datatable(dataset_final_e97, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

Análise

cor_matrix
##            raoq      FRic       FEve       FDis          FD
## raoq  1.0000000 0.1762663 0.19790931  0.9697383 -0.19715587
## FRic  0.1762663 1.0000000 0.15502712  0.1612947  0.79029689
## FEve  0.1979093 0.1550271 1.00000000  0.3268466  0.04754828
## FDis  0.9697383 0.1612947 0.32684660  1.0000000 -0.18431343
## FD   -0.1971559 0.7902969 0.04754828 -0.1843134  1.00000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(log(meanFunction) ~ raoq + FRic + (1|Field.letter),data = e97)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          log(meanFunction) ~ raoq + FRic + (1 | Field.letter)
## Data: e97
## 
##      AIC      BIC   logLik deviance df.resid 
##   -247.4   -234.0    128.7   -257.4      103 
## 
## Random effects:
## 
## Conditional model:
##  Groups       Name        Variance Std.Dev.
##  Field.letter (Intercept) 0.008875 0.09421 
##  Residual                 0.004963 0.07045 
## Number of obs: 108, groups:  Field.letter, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00496 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.713e-01  8.333e-02  -4.456 8.36e-06 ***
## raoq        -1.744e-03  8.262e-04  -2.111   0.0348 *  
## FRic        -6.280e-06  5.547e-05  -0.113   0.9099    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## [1] 26
ggplot(e97, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(e97, aes(x = raoq, y = meanFunction, color = as.factor(Field.letter))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Field.letter)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

#Tirando outliers
e97_semot <- e97 %>% 
  filter(!raoq <40) %>%   
  filter(!meanFunction >0.9)

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|Field.letter),data = e97_semot)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | Field.letter)
## Data: e97_semot
## 
##      AIC      BIC   logLik deviance df.resid 
##   -365.3   -352.0    187.6   -375.3      101 
## 
## Random effects:
## 
## Conditional model:
##  Groups       Name        Variance Std.Dev.
##  Field.letter (Intercept) 0.002786 0.05278 
##  Residual                 0.001558 0.03947 
## Number of obs: 106, groups:  Field.letter, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00156 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  6.475e-01  4.952e-02  13.076   <2e-16 ***
## raoq        -5.073e-04  5.304e-04  -0.956    0.339    
## FRic         1.815e-05  3.150e-05   0.576    0.564    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(e97_semot, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(e97_semot, aes(x = raoq, y = meanFunction, color = as.factor(Field.letter))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Field.letter)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(e97_semot, aes(x = FRic, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

e120

Biodiversity II, effects od plant biodiversity on population and ecossystem process

  • Determinar como a quantidade de espécies de plantas afeta processos ecológicos nos níveis populacional, de comunidade e ecossistêmico. Como a diversidade de plantas influencia a produção de biomassa, a estabilidade do ecossistema, a incidência de doenças, a diversidade de insetos herbívoros e predadores, e outros parâmetros do solo.

168 parcelas de 9m x 9m.

Tratamentos: Parcelas com 1, 2, 4, 8 ou 16 espécies de plantas, com cerca de 30 réplicas para cada nível de diversidade.

COMPOSIÇÃO DAS ESPECIES

datatable(cover, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
# Calcular a cobertura relativa por quadrante dentro de cada plot
cover <- cover %>%
  group_by(Year, Plot, Quadrat) %>%
  mutate(percentage_cover = 100 * Abscover / sum(Abscover, na.rm = TRUE))

# Somar a cobertura por espécie dentro de cada plot e ano
cover <- cover %>%
  group_by(Year, Plot, Species) %>%
  summarize(Total_Abscover = sum(percentage_cover, na.rm = TRUE)) %>%
  ungroup()
## `summarise()` has grouped output by 'Year', 'Plot'. You can override using the
## `.groups` argument.
# Padronizar para que a soma total seja 100% dentro de cada plot
cover <- cover %>%
  group_by(Year, Plot) %>%
  mutate(cover_final = 100 * Total_Abscover / sum(Total_Abscover, na.rm = TRUE)) %>%
  ungroup()

ggplot(cover, aes(x = Total_Abscover)) +
geom_histogram(bins = 50, fill = "blue", color = "black")

ggplot(cover, aes(x = cover_final)) +
  geom_histogram(bins = 50, fill = "blue", color = "black")

FUNCIONAL

fd_96 <- dbFD(trait_dat_96, abundance_96_matrix)
## FRic: Dimensionality reduction was required. The last 65 PCoA axes (out of 67 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9626396
Functional_96 <- data.frame(raoq = fd_96$RaoQ, FRic = fd_96$FRic,FEve = fd_96$FEve, FDis = fd_96$FDis, FD = fd_96$nbsp )

hist(Functional_96$FRic)

hist(Functional_96$raoq)

Funcional 2000

SPECIES_00 <- data.frame(species = colnames(abundance_00_matrix))

SPECIES_00$Species <- tolower(SPECIES_00$species)
TRAITS$Species <- tolower(TRAITS$Species) 
TRAITS_00 <- SPECIES_00 %>%
  inner_join(TRAITS, by = "Species") %>% 
  dplyr::select(Species, Leaf.area.per.leaf.dry.mass, Plant.height.vegetative)

rownames(TRAITS_00) <- TRAITS_00$Species
TRAITS_00_rn <- TRAITS_00[,-1]

TRAITS_00_rn <- TRAITS_00_rn[order(rownames(TRAITS_00_rn)), ]

# Matriz de distância dos traits para o ano 2000
euclid_dis_00 <- vegdist(TRAITS_00_rn, "euclidean")
trait_dat_00 <- as.matrix(euclid_dis_00)

colnames(abundance_00_matrix) <- tolower(trimws(colnames(abundance_00_matrix)))
abundance_00_matrix <- abundance_00_matrix[, order(colnames(abundance_00_matrix))]

colnames(abundance_00_matrix) <- tolower(trimws(colnames(abundance_00_matrix)))
rownames(trait_dat_00) <- tolower(trimws(rownames(trait_dat_00)))

abundance_00_matrix <- abundance_00_matrix[, order(colnames(abundance_00_matrix))]
trait_dat_00 <- trait_dat_00[order(rownames(trait_dat_00)), order(colnames(trait_dat_00))]


# Cálculo da diversidade funcional para o ano 2000
fd_00 <- dbFD(trait_dat_00, abundance_00_matrix)
## FEVe: Could not be calculated for communities with <3 functionally singular species. 
## FDis: Equals 0 in communities with only one functionally singular species. 
## FRic: To respect s > t, FRic could not be calculated for communities with <3 functionally singular species. 
## FRic: Dimensionality reduction was required. The last 61 PCoA axes (out of 64 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9764963 
## FDiv: Could not be calculated for communities with <3 functionally singular species.
Functional_00 <- data.frame(raoq = fd_00$RaoQ, FRic = fd_00$FRic, FEve = fd_00$FEve, FDis = fd_00$FDis, FD = fd_00$nbsp)

# Visualização dos histogramas para o ano 2000
hist(Functional_00$FRic)

hist(Functional_00$raoq)

# Combina 
Functional_120 <- bind_rows(Functional_96, Functional_00)

MULTIFUNCIONALIDADE

#quantidades de amostragem tudo diferente nos anos 
#carbon_nitroFunc 1164
#biomassaFunc 1862
#soil_carbonFunc 726
#nitrat_amoniFunc 1194
#soil_nitroFunc 726

data_list <- list(carbon_nitroFunc, biomassaFunc, soil_carbonFunc, nitrat_amoniFunc, soil_nitroFunc)
combined_data <- reduce(data_list, full_join, by = c("Year", "Plot"))

#remover todos os dados ausentes
#so sobra 1996 e 2000
funcoes_120 <- na.omit(combined_data)
e120_multifuncionalidade <- cbind(dataset_120, getStdAndMeanFunctions(dataset_120, vars120))

Dataset COMPLETO

dataset_final_120 <- e120_multifuncionalidade %>%
  left_join(Functional_120, by = c("Plot", "Year")) 

datatable(dataset_final_120, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
#Vou apenas cortar
##Help####
dataset_final_120 <- dataset_final_120 %>% 
  filter(FDis < 10, raoq < 50, FRic < 200)

Análise

cor_matrix
##           raoq       FRic        FEve      FDis         FD
## raoq 1.0000000  0.3617443  0.20966865 0.9034204 0.31977113
## FRic 0.3617443  1.0000000 -0.03683210 0.2803202 0.62470882
## FEve 0.2096687 -0.0368321  1.00000000 0.1254367 0.03035598
## FDis 0.9034204  0.2803202  0.12543665 1.0000000 0.37908210
## FD   0.3197711  0.6247088  0.03035598 0.3790821 1.00000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(log(meanFunction) ~ raoq + FRic + (1|Year),data = e120)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          log(meanFunction) ~ raoq + FRic + (1 | Year)
## Data: e120
## 
##      AIC      BIC   logLik deviance df.resid 
##   -153.8   -136.1     81.9   -163.8      251 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev.
##  Year     (Intercept) 0.0001907 0.01381 
##  Residual             0.0307340 0.17531 
## Number of obs: 256, groups:  Year, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.0307 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.0245998  0.0409540 -25.018  < 2e-16 ***
## raoq         0.0046731  0.0011239   4.158 3.21e-05 ***
## FRic        -0.0000661  0.0003732  -0.177    0.859    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## [1]  12  73 148 185
ggplot(e120, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120, aes(x = raoq, y = meanFunction, color = as.factor(Year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

#Tirando outliers
e120_semot <- e120 %>% 
  filter(!raoq >100) %>% 
  filter(!FRic >150)

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|Year),data = e120_semot)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | Year)
## Data: e120_semot
## 
##      AIC      BIC   logLik deviance df.resid 
##   -428.6   -412.9    219.3   -438.6      167 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev. 
##  Year     (Intercept) 3.796e-12 1.948e-06
##  Residual             4.571e-03 6.761e-02
## Number of obs: 172, groups:  Year, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00457 
## 
## Conditional model:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) 3.564e-01  1.065e-02   33.46  < 2e-16 ***
## raoq        2.243e-03  5.463e-04    4.11 4.02e-05 ***
## FRic        7.081e-05  1.266e-04    0.56    0.576    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(e120_semot, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120_semot, aes(x = raoq, y = meanFunction, color = as.factor(Year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 5 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120_semot, aes(x = FRic, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 5 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120_semot, aes(x = FRic, y = meanFunction, color=as.factor(Year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 5 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).

Jena dBEF

Tratamento 1 - Sem história de solo e sem história de plantas: O solo e a camada de plantas foram removidos até 30 cm de profundidade e substituídos por solo de um campo arável adjacente. Tratamento 2 - Com história de solo, mas sem história de plantas: A camada de plantas foi removida, mas o solo original foi mantido. Tratamento 3 - Com história de solo e de plantas: As parcelas existentes do experimento principal, estabelecidas desde 2002, foram mantidas como controle de longo prazo, mantendo tanto a história do solo quanto a das plantas. Esses tratamentos foram projetados para testar como a história do solo e das plantas influenciam a produtividade vegetal e as interações ecológicas ao longo do tempo, considerando tanto a diversidade de plantas quanto os efeitos do histórico do solo sobre a biomassa e outros fatores ecológicos.

80 plots 3 tratamentos 3 anos

COMPOSIÇÃO DAS ESPÉCIES: cobertura

cobertura_2017 <- read.csv("dbef/PLANT_COVER_2017.csv", sep = ";")
cobertura_2018 <- read.csv("dbef/PLANT_COVER_2018.csv", sep = ";")
cobertura_2019 <- read.csv("dbef/PLANT_COVER_2019.csv", sep = ";")

cobertura_total <- bind_rows(cobertura_2017, cobertura_2018, cobertura_2019)
datatable(cobertura_total, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html

FUNCIONAL

#diversidade funcional
fd_dbef <- dbFD(trait_dat_dbef, abundance_dbef_matrix_clean)
## FEVe: Could not be calculated for communities with <3 functionally singular species. 
## FDis: Equals 0 in communities with only one functionally singular species. 
## FRic: To respect s > t, FRic could not be calculated for communities with <3 functionally singular species. 
## FRic: Dimensionality reduction was required. The last 57 PCoA axes (out of 59 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.7574923 
## FDiv: Could not be calculated for communities with <3 functionally singular species.
Functional_dbef <- data.frame(raoq = fd_dbef$RaoQ, FRic = fd_dbef$FRic,FEve = fd_dbef$FEve, FDis = fd_dbef$FDis, FD = fd_dbef$nbsp )

datatable(Functional_dbef, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

MULTIFUNCIONALIDADE

# Combinar os Dados com a Base
dados_combinados <- base %>%
  left_join(cobertura_media, by = c("plot", "treatment", "year")) %>%
  left_join(biomass_summary, by = c("plot", "treatment", "year")) %>%
  left_join(atv_micro, by = c("plot", "treatment", "year")) %>%
  left_join(herbivoria_total, by = c("plot", "treatment", "year")) %>%
  left_join(predacao, by = c("plot", "treatment", "year"))
dbef_multifunc <- cbind(dados_combinados, getStdAndMeanFunctions(dados_combinados, func_vars))

DATASET COMPLETAO

dataset_final_JENA <- dbef_multifunc %>%
  left_join(Functional_dbef, by = c("plot", "treatment", "year"))

datatable(dataset_final_JENA, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

Análise

cor_matrix
##           raoq       FRic       FEve      FDis        FD
## raoq 1.0000000 0.55127018 0.33838727 0.9545245 0.4651809
## FRic 0.5512702 1.00000000 0.09063385 0.4986894 0.6718329
## FEve 0.3383873 0.09063385 1.00000000 0.3517603 0.2450418
## FDis 0.9545245 0.49868937 0.35176030 1.0000000 0.4626148
## FD   0.4651809 0.67183287 0.24504183 0.4626148 1.0000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|year),data = jena)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | year)
## Data: jena
## 
##      AIC      BIC   logLik deviance df.resid 
##  -1285.8  -1266.2    647.9  -1295.8      364 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev.
##  year     (Intercept) 0.0008237 0.02870 
##  Residual             0.0016904 0.04111 
## Number of obs: 369, groups:  year, 3
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00169 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  2.125e-01  1.723e-02  12.334  < 2e-16 ***
## raoq        -2.653e-04  1.732e-04  -1.532 0.125645    
## FRic         1.402e-04  4.223e-05   3.319 0.000903 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## [1] 363
ggplot(jena, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena, aes(x = FRic, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 351 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 351 rows containing missing values or values outside the scale range
## (`geom_point()`).

#Tirando outliers
jena_semot <- jena %>% 
  filter(!raoq >75)

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|year),data = jena_semot)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | year)
## Data: jena_semot
## 
##      AIC      BIC   logLik deviance df.resid 
##  -1281.6  -1262.0    645.8  -1291.6      363 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev.
##  year     (Intercept) 0.0008164 0.02857 
##  Residual             0.0016935 0.04115 
## Number of obs: 368, groups:  year, 3
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00169 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  2.118e-01  1.720e-02  12.311  < 2e-16 ***
## raoq        -2.293e-04  1.840e-04  -1.247  0.21247    
## FRic         1.375e-04  4.253e-05   3.232  0.00123 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(jena_semot, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 160 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 160 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena_semot, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 160 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 160 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena_semot, aes(x = FRic, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 347 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 347 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena_semot, aes(x = FRic, y = meanFunction, color=as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 347 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 347 rows containing missing values or values outside the scale range
## (`geom_point()`).